﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HandyControl.Controls;
using clf.weighing.entity;
using Image = System.Windows.Controls.Image;

namespace weighing
{
    /// <summary>
    /// BigImageWindow.xaml 的交互逻辑
    /// </summary>
    public partial class BigImageWindow : GlowWindow
    {
        private BillImage mImage;
        private ImageSource imgSource;
        public BigImageWindow(ImageSource source, BillImage image)
        {
            InitializeComponent();
            this.mImage = image;
            this.imgSource = source;

            CommonFunction.ShowCustomIcon(this);
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
          
            this.Title = mImage.billNumber +"大图";
        }

        private void Window_ContentRendered(object sender, EventArgs e)
        {
            string tip = mImage.localPath.IsNullOrEmpty() ? mImage.remoteUrl : mImage.localPath;
            var ni = new Image
            {
                Source = imgSource,
                Stretch = Stretch.Uniform,
                AllowDrop = true,
                ToolTip = tip,
                
            };
            this.imageVb.Child = ni;
        }

        private void Window_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == Key.Escape) this.Close();
        }
    }
}
